//
//  NRWBuyCarListDataModel.m
//  NRWMall
//
//  Created by 张记 on 2018/6/12.
//  Copyright © 2018年 com.anpxd. All rights reserved.
//

#import "NRWBuyCarListDataModel.h"

@implementation NRWBuyCarListDataModel
+ (NSDictionary *)objectClassInArray{
    return @{@"result" : [Result class]};
}

@end

@implementation Result
{
	NSString *_tempCardTime;
	dispatch_group_t disGroup;
}

//- (instancetype)init
//{
//	self = [super init];
//	if (self) {
//		disGroup = dispatch_group_create();
//		
//		dispatch_group_notify(disGroup, dispatch_get_main_queue(), ^{
//			if (self.carLicenceState == 1) {
//				self->_onTheCardTiem = [NSString stringWithFormat:@"%@",[NRWCarTurnTime timestampSwitchTime:self.carLicenceDate andFormatter:@"yyyy年MM月"]];
//			}else if (self.carLicenceState == 2){
//				self->_onTheCardTiem = @"未上牌";
//			}else if (self.carLicenceState == 3 ){
//				self->_onTheCardTiem = @"新车";
//			}
//		});
//	}
//	return self;
//}

- (void)setCarMileage:(CGFloat)carMileage {
	
	_carMileage = carMileage;
	
	if (self.carMileage <= 0) {
		self.carMileageStr = @"未输入里程";
	}else{
		if (self.carMileage < 0.1) {
			self.carMileageStr = [NSString stringWithFormat:@"%.f公里", self.carMileage *10000];
		}else{
			self.carMileageStr = [NSString stringWithFormat:@"%.2f万公里",self.carMileage];
		}
	}
}

- (void)setCarRetailPrice:(CGFloat)carRetailPrice {
	
	_carRetailPrice = carRetailPrice;
	
	if (self.carRetailPrice <= 0) {
		_priceStr = @"价格面议";
	}else{
		_priceStr = [NSString stringWithFormat:@"%.2f",self.carRetailPrice];
	}
}

- (NSString *)carMileageStr {
	
	if (isEmptyString(_carMileageStr)) {
		return @"未输入里程";
	} return
	_carMileageStr;
}

- (NSString *)priceStr {
	
	if (isEmptyString(_priceStr)) {
		return @"价格面议";
	} else {
		return _priceStr;
	}
}

//- (void)setCarLicenceDate:(long long)carLicenceDate {
//
//	dispatch_group_enter(disGroup);
//	_carLicenceDate = carLicenceDate;
//	dispatch_group_leave(disGroup);
//}
//
//- (void)setCarLicenceState:(NSInteger)carLicenceState {
//
//	dispatch_group_enter(disGroup);
//	_carLicenceState = carLicenceState;
//	dispatch_group_leave(disGroup);
//}

//-(NSString *)carMileageStr{
//    if (self.carMileage  <= 0) {
//        _carMileageStr = @"未输入里程";
//    }else{
//        if (self.carMileage < 0.1) {
//            _carMileageStr = [NSString stringWithFormat:@"%.f公里", self.carMileage *10000];
//        }else{
//            _carMileageStr = [NSString stringWithFormat:@"%.2f万公里",self.carMileage];
//        }
//    }
//    return _carMileageStr;
//}
//-(NSString *)priceStr{
//    if (self.carRetailPrice <= 0) {
//        _priceStr = @"价格面议";
//    }else{
//        _priceStr = [NSString stringWithFormat:@"%.2f",self.carRetailPrice];
//    }
//    return _priceStr;
//}
-(NSString *)onTheCardTiem{
	
	if (isEmptyString(_tempCardTime)) {
		
		if (self.carLicenceState == 1) {
			_onTheCardTiem = [NSString stringWithFormat:@"%@",[NRWCarTurnTime timestampSwitchTime:self.carLicenceDate andFormatter:@"yyyy年MM月"]];
		}else if (self.carLicenceState == 2){
			_onTheCardTiem = @"未上牌";
		}else if (self.carLicenceState == 3 ){
			_onTheCardTiem = @"新车";
		}
		_tempCardTime = _onTheCardTiem;
	}
	
    return _tempCardTime;
}
@end


@implementation Series

@end

@implementation Brand

@end

@implementation Region

@end

@implementation Market

@end

@implementation City

@end

@implementation Shop

@end

@implementation User

@end

